<template>
    <div>
      <div class="title">
        <el-row>
          <el-col :span="1" style="width: 50px;">
            <span style="color:#757575;">位置 :</span>
          </el-col>
          <el-col :span="20">
            <span @click="tableshow" class="hand" :class="{'textactive' : !secondshow}">{{title}}</span>
            <span v-if="secondshow" :class="{'textactive' : secondshow}">> {{secondtitle}}</span>
          </el-col>
        </el-row>
      </div>
      <div class="posttable" v-if="mainShow">
      <el-row type="flex" justify="center">
        <el-col :span="23">
          <div  style="margin-bottom:20px;float: right;">
          <el-row  type="flex" justify="space-between" style="margin-top: 11px;" class="btn">
              <el-input
                style="width: 136px;"
                size="small"
                placeholder="请输入内容"
                v-model.trim="inputValue"
                @keyup.enter.native="searchMsg"
              >
                <i
                  slot="suffix"
                  class="el-input__icon el-icon-search"
                  style="cursor: pointer;"
                  @click="searchMsg"
                ></i>
              </el-input>
              <div style="margin-left: 5px;">
                <el-button
                  class="add"
                  :class="{'active' : newcolor}"
                  size="small"
                  @mousedown.native="adddown"
                  @mouseup.native="addup"
                  @click="addshow"
                  round
                >新增
                </el-button>
              </div>
          </el-row>
          </div>
        </el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="23">
          <el-table
            ref="singleTable"
            highlight-current-row
            :data="tableData"
            @current-change="handleCurrentChange"
          >
            <el-table-column
              label="推送客户"
            >
              <template slot-scope="scope">
                <span style="cursor: pointer" @click="viewdetail(scope.row)">{{scope.row.customerName}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="postName"
              label="推送职位">
            </el-table-column>
            <el-table-column
              prop="postLevel"
              label="职位级别">
            </el-table-column>
            <el-table-column
              prop="area"
              label="所属区域"
            >
            </el-table-column>
            <el-table-column
              label="姓名">
              <template slot-scope="scope">
                <span v-if="scope.row.fileAddress !== null"><a class="other" :href="scope.row.group+'/'+scope.row.fileAddress" target="_blank">{{scope.row.name}}</a></span>
                <span v-if="scope.row.fileAddress == null">{{scope.row.name}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop=""
              label="毕业时间"
            >
              <template slot-scope="scope">
                <span>{{scope.row.graduationTime}}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="出生年月"
            >
              <template slot-scope="scope">
                <span>{{scope.row.birthday}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="phone"
              label="联系方式"
            >
            </el-table-column>
            <el-table-column
              prop="status"
              label="离职状态"
            >
            </el-table-column>
            <el-table-column
              prop="expectSalary"
              label="期望薪资"
            >
              <template slot-scope="scope">
                <span v-if="scope.row.customerName !== '港交所'">{{scope.row.expectSalary}}k*{{scope.row.expectSalaryNum}}</span>
                <span v-if="scope.row.customerName == '港交所'">无</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="entryTime"
              label="到岗时间"
            >
              <template slot-scope="scope">
                <span>{{scope.row.entryTime}}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="初步评价"
            >
            <template slot-scope="scope">
              <span v-if="scope.row.customerName !== '港交所'" style="overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{scope.row.initialEvaluation}}</span>
              <span v-if="scope.row.customerName == '港交所'">无</span>
            </template>
            </el-table-column>
          </el-table>

          <div class="pager">

            <el-pagination
              @size-change="handleSizeChange"
              @current-change="pagehandleCurrentChange"
              :current-page="currentPage"
              :page-sizes="[5,10,15]"
              :page-size="pagesize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      </div>
      <resume-add v-if = "addShow" @getData="getData1"></resume-add>
      <resume-detail v-if = 'detailShow' :detail='scopeData'></resume-detail>
    </div>
</template>
<script>
import ResumeAdd from './resumeadd'
import ResumeDetail from './resumedetail'
import axios from 'axios'
import qs from 'qs'
export default {
  name:"instorage",
  data(){
    return{
      scopeData:{},
      title:"",
      secondtitle:"",
      secondshow:false,
      mainShow:true,
      addShow:false,
      detailShow:false,
      inputValue:"",
      newcolor:false,
      tableData:[],
      currentRow:null,
      currentPage: 1,
      pagesize: 15,
      totalcount: null,
    }
  },
  created(){
    this.title = this.$route.meta.title;
    this.getData();
  },
  methods:{
    getData(){
      this.addShow = false;
      this.mainShow = true;
      this.detailShow = false;
      this.secondtitle = "";
      this.secondshow = false;
      axios.post(this.url + "/resumeUpload/getMailList",{
        condition:"",
        pageNum: this.currentPage,
        pageSize: this.pagesize
      }).then(res =>{
        this.unlogin(res.data.code)
        if(res.data.code == 200){
          this.tableData = res.data.data.list;
          this.totalcount = res.data.data.total;
        }
      })
    },
    getData1(){
      this.addShow = false;
      this.mainShow = true;
      this.secondtitle = "";
      this.secondshow = false;
      this.currentPage = 1;
      axios.post(this.url + "/resumeUpload/getMailList",{
        condition:"",
        pageNum: this.currentPage,
        pageSize: this.pagesize
      }).then(res =>{
        this.unlogin(res.data.code)
        if(res.data.code == 200){
          this.tableData = res.data.data.list;
          this.totalcount = res.data.data.total;
        }
      })
    },
    tableshow(){
      this.addShow = false;
      this.mainShow = true;
      this.detailShow = false;
      this.secondtitle = "";
      this.secondshow = false;
    },
    searchMsg(){
      this.currentPage = 1;
      axios.post(this.url + "/resumeUpload/getMailList",{
        condition:this.inputValue,
        pageNum: this.currentPage,
        pageSize: this.pagesize
      }).then(res =>{
        this.unlogin(res.data.code)
        if(res.data.code == 200){
          this.tableData = res.data.data.list;
          this.totalcount = res.data.data.total;
        }
      })
    },
    //鼠标按下新增按钮
    adddown() {
      this.newcolor = true;
    },
    //点击按钮弹起
    addup() {
      this.newcolor = false;
    },
    addshow(){
      this.addShow = true;
      this.mainShow = false;
      this.secondtitle = "新增简历";
      this.secondshow = true;
    },
    handleCurrentChange(val){
      this.currentRow = val;
    },
    handleSizeChange(val) {
      this.pagesize = val;
      this.getData();
    },
    pagehandleCurrentChange(val) {
      this.currentPage = val;
      this.getData();
    },
    viewdetail(val){
      this.scopeData = val;
      this.mainShow = false;
      this.detailShow = true;
      this.secondtitle = "简历详情";
      this.secondshow = true;
    }
  },
  components:{
    ResumeAdd,
    ResumeDetail
  },
  watch:{
    "inputValue":function(val){
      if(val == ""){
        this.currentPage = 1;
        this.getData();
      }
    }
  }
}
</script>
<style scoped>
.title {
  background-color: #fff;
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  padding-left: 20px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.posttable {
  min-height: 700px;
  background-color: #fff;
}
.textactive {
  color: #1099ff;
}
.add {
  width: 65px;
  height: 28px;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #5696f8 0%, #143dea 100%);
  padding: 7px 15px !important;
}

.add:hover {
  color: #fff !important;
}
.active {
  background: linear-gradient(to bottom, #595dff 0%, #7073ff 100%);
}
.pager {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin-top: 10px;
  margin-bottom: 10px;
}

.el-pagination {
  margin-left: 50%;
  transform: translateX(-50%);
}
.other {
  color: #1198ff;
  cursor: pointer;
  text-decoration: none;
}
</style>
